home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_100
/
137_01
/
dec83col.ddj
< prev
next >
Wrap
Text File
|
1980-01-01
|
15KB
|
304 lines
.pl 60
.po 0
..
.. "The C/Unix Programmer's Notebook"
..
.. DDJ Column #2 as of 19-Sep-83
.. (C) 1983 Anthony Skjellum. All rights reserved.
.. For publication in DDJ
..
..
.. file (DDJCOL2.WS) created: 19-Sep-83
.. updated: 24-Sep-83
.. updated:
..
.. completed: 25-Sep-83
..
.he "C/Unix Programmer's Notebook" by Anthony Skjellum. (C) 1983. For December, 1983, DDJ.
A Correction
In the last column, several references to the book The C Program-
ming Language and its authors were made. Through my error, Brian
Kernighan's name was misspelled consistently throughout the column. I'm
sure that many readers noticed this immediately. Unfortunately, I didn't
until I saw the column in DDJ.
Introduction
In this second Programmer's Notebook, I'll discuss how Unix-type
environments can lead to non-interactive, and user-unfriendly software.
This is based on experiences I've had with several Unix and Unix-like
systems running both standard and Berkeley Unix.
.. Last time, I discussed incompatible linkage formats and runtime
.. libraries of C compilers in both the eight and sixteen-bit world. This
.. time, the discussion will concentrate on problems and difficulties I've
.. encountered through in with linkers and C libraries in my work under MS-
.. DOS.
Skimming through the ads in the October DDJ, I noticed that nearly
twenty-five percent of the ads concerned or mentioned C or Unix. Most of
them concerned C. This indicates strongly that C and to a lesser extent,
Unix, are popular items with DDJ readers. I also hope that reader input
will be significant as it has been with other DDJ columns.
I also saw an extremely interesting advertisement in the October
DDJ. This was a Computer Innovations ad concerning the soon-to-be-released
version of their C compiler. As an option, this compiler will produce
programs/data exceeding the previous limit of 64K segments imposed by all
8086 compilers (C or otherwise) that I've seen. Look for a review in this
column early next year.
Unix and non-interactive Software
The Unix operating system was designed to reduce repetition of
programming effort by permitting modular programs to be combined via pipes
and tees. Since input and output are redirectable under Unix, simple
programs could use console input and output for one application and be used
as part of a pipeline for another. Thus, unmodified programs could be
reharnessed for new applications to an extent not possible with previous
operating systems.
Pipes and input-output redirection are two of the best and well-
known features of the Unix system. Microcomputer users have been very
interested in adding these capabilities to their own operating environ-
ments. In the eight-bit world, this has been done chiefly through special
subroutine libraries such as "The Unica," or in C runtime packages. For
MS-DOS 2.0 users, the features are built into the operating system.
Despite the undisputed usefulness of pipelines and input-output
redirection, their presence in Unix has lead to a serious drawback in the
system's environment. This drawback is the proclivity to avoid interactive
programs and to produce user-unfriendly software. Furthermore, the
standard Unix console interface is weaker than under other operating
systems. In the remainder of this column I will discuss these weaknesses
as I perceive them.
Non-interactive Software
Because of the availability of pipes and input-output redirection,
many Unix programs are designed to act as filters. Filters are programs
which require a single sequential input data stream and produce a single
output data stream. Such programs are suitable as pipe-fittings. Because
of the way they handle data, they don't normally expect to be used
interactively. In most cases this doesn't pose a problem for users.
However, because such programs do not expect to deal directly with humans,
but only with input and output streams, they can often be very unfriendly
in the area of error handling.
..
The problem in the Unix system is that the same terse philosophy
applied to filters also pervades most of the software available. This
includes programs which are normally executed sequentially by the user from
the console. The problems come in several areas and some of these
problem areas are listed in Table I. The following paragraphs will
elaborate each of the points listed in that table.
---------------------------------TABLE I.---------------------------------
-----------------------(Unix software Problem Areas)----------------------
1. terse (hard-to-remember) program names.
2. lack of program sign-on and sign-off messages.
3. lack of interactive mode to alleviate the need
to re-execute a program several times to complete
a set of operations.
4. inconsistent use of switch (dash options) for
controlling the specifics of program execution.
5. lack of descriptive error messages.
6. cryptic, incomplete, and erroneous documentation
7. software bugs: un-documented and documented.
8. cryptic (or missing) internal help features.
9. poor console interface provided by Unix.
10. lack of system for finding program names by the
function required.
------------------------------END OF TABLE I.------------------------------
.pa
Terse Names
Unix program names are usually two or three letters long and tend
to be cryptic. While this saves typing for experienced users, its
frustrating for new and occasional system users. Also, since the Unix
system lacks an on-line indexing system for finding program names by
function, it's not easy to find the right program based on the desired
function alone.
Sign-ons and Sign-offs
Sign-on and Sign-off messages are a common courtesy in the computer
world. Virtually all standard Unix programs lack these two simple
features. While this is understandable for filters, it is completely
unnecessary for other programs. For example, if two versions of a program
exist on a system, the only easy way to distinguish them is by their sign-
on messages.
Besides sign-ons/offs, its also nice for a program to give progress
reports during execution. This lets the user know how things are
proceeding. Standard Unix software doesn't normally include such a
feature.
Internal Help Features
Many programs include a feature summary option to help occasional
and new users remind themselves of program operation. Many Unix programs
also have this capability, but they are often extremely cryptic and include
few English words to supplement the sample command line which they display.
Figure I. displays a sample session in which a ficticious program (called
fct) is executed from the shell with no arguments. The program responds
with a cryptic help summary typical of actual Unix commands. In Figure
II. the same fct program session is presented, but this time the program
has been designed to provide a user-friendly help feature (and also to
sign-on and off).
---------------------------------FIGURE I.--------------------------------
---------------------------(Cryptic fct Session)--------------------------
$ fct <RETURN> (activate the program with no arguments)
usage: fct -abcv file1..fileN (help message)
$ (shell prompt)
-------------------------------END FIGURE I.------------------------------
.pa
--------------------------------FIGURE II.------------